package gof.com.yew.chainOfRes;

public class ChainPatternDemo {
	
	public static AbstractLogger getChainLogger() {
		AbstractLogger c = new ConsoleLogger(AbstractLogger.INFO);
		AbstractLogger d = new DebugLogger(AbstractLogger.DEBUG);
		AbstractLogger e = new ErrorLogger(AbstractLogger.ERROR);
		e.setNextLogger(d);
		d.setNextLogger(c);
		return e;
	}
	
	public static void main(String[] args) {
		AbstractLogger logger = getChainLogger();
		logger.logMsg(AbstractLogger.INFO, "This is an information.");
		 
		logger.logMsg(AbstractLogger.DEBUG,  "This is a debug level information.");
	 
		logger.logMsg(AbstractLogger.ERROR,  "This is an error information.");
	   }

}
